﻿
@model ProfileIM

@using (Ajax.BeginForm("Edit", "User",
                                                    new AjaxOptions()
                                                    {
                                                        HttpMethod = "POST",
                                                        OnBegin = "onBeginSave",
                                                        OnComplete = "onCompleteSave",
                                                        OnSuccess = "onSuccess",
                                                        //OnFailure = "handleError",
                                                        //  UpdateTargetId = "RoleList"

                                                    }, new { @class = "form-horizontal", role = "form" }))
{
    @Html.AntiForgeryToken()
    @Html.ValidationSummary(true)
    @Html.HiddenFor(model => model.Id)

    <!-- 添加菜单 Modal -->
    <div class="modal fade" id="ModalEdit" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="myModalLabel">编辑用户资料</h4>
                </div>
                <div class="modal-body">

                    <div class="form-group">
                        @Html.LabelFor(model => model.UserName, htmlAttributes: new { @class = "control-label col-md-3" })
                        <div class="col-md-9">
                            <p class="form-control-static">
                                @Html.DisplayFor(model => model.UserName)
                            </p>
                        </div>
                    </div>


                    <div class="form-group">
                        @Html.LabelFor(model => model.Email, htmlAttributes: new { @class = "control-label col-md-3" })
                        <div class="col-md-9">
                            @Html.EditorFor(model => model.Email, new { htmlAttributes = new { @class = "form-control" } })
                            @Html.ValidationMessageFor(model => model.Email)
                        </div>
                    </div>



                    <div class="form-group">
                        @Html.LabelFor(model => model.RealName, htmlAttributes: new { @class = "control-label col-md-3" })
                        <div class="col-md-9">
                            @Html.EditorFor(model => model.RealName, new { htmlAttributes = new { @class = "form-control" } })
                            @Html.ValidationMessageFor(model => model.RealName)
                        </div>
                    </div>
                    <div class="form-group">
                        @Html.LabelFor(model => model.Birthday, htmlAttributes: new { @class = "control-label col-md-3" })
                        <div class="col-md-9">

                            @Html.EditorFor(model => model.Birthday, new { htmlAttributes = new { @class = "form-control" } })
                            @Html.ValidationMessageFor(model => model.Birthday)
                        </div>
                    </div>

                    <div class="form-group">
                        @Html.LabelFor(model => model.Gender, htmlAttributes: new { @class = "control-label col-md-3" })
                        <div class="col-md-9">
                            @Html.EnumDropDownListFor(model => model.Gender, htmlAttributes: new { @class = "form-control" })
                            @Html.ValidationMessageFor(model => model.Gender)
                        </div>
                    </div>

                    <div class="form-group">
                        @Html.LabelFor(model => model.Mobile, htmlAttributes: new { @class = "control-label col-md-3" })
                        <div class="col-md-9">
                            @Html.EditorFor(model => model.Mobile, new { htmlAttributes = new { @class = "form-control" } })
                            @Html.ValidationMessageFor(model => model.Mobile)
                        </div>
                    </div>

                    <div class="form-group">
                        @Html.LabelFor(model => model.QQ, htmlAttributes: new { @class = "control-label col-md-3" })
                        <div class="col-md-9">
                            @Html.EditorFor(model => model.QQ, new { htmlAttributes = new { @class = "form-control" } })
                            @Html.ValidationMessageFor(model => model.QQ)
                        </div>
                    </div>


                    <div class="form-group">
                        @Html.LabelFor(model => model.IsActive, htmlAttributes: new { @class = "control-label col-md-3" })
                        <div class="col-md-9">
                            <div class="checkbox">
                                <label>
                                    @Html.EditorFor(model => model.IsActive)
                                    @Html.ValidationMessageFor(model => model.IsActive)
                                </label>
                            </div>
                        </div>
                    </div>

                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                    <button class="btn btn-primary" type="submit" id="btnSave"><i class="fa fa-save fa-fw"></i>保存</button>
                </div>
            </div>
        </div>
    </div>
}

<script type="text/javascript" language=javascript>
    $.validator.unobtrusive.parse(document);
</script>